#include<iostream>
using namespace std;

using elem_type =  double;

class quad{
protected:
    string name;
public:
    double anser = 0;
    char result ='\0';
public:
    quad(string name = "quad" ):name(name){} 
    ~quad() {}
    virtual double area() const = 0 ;
    virtual void showinfo() const = 0 ;
    virtual void review() const = 0 ;
};

class trap : public quad{
protected :
    elem_type width1,width2,hight;

public :
    trap(elem_type _width1,elem_type _width2,elem_type _hight ) : quad("trad"),width1(_width1),width2(_width2),hight(_hight){ }
    ~trap() {}
    double area() const {return (width1 + width2)*hight / 2.0 ;}
    void showinfo()const {
        cout<<"this is a "<<name<<" the width1 is   "<<width1<<" the width2 is   "<<width2<<"   the hight is   "<<hight<<endl;
    }
    void review()const {
        cout<<name<<":  "<<"width1="<<width1<<", width2="<<width2<<", hight="<<hight<<", anser="<<anser<<"  "<<result<<endl;
    }
};

class para : public quad{
protected :
    elem_type width,hight;

public :
    para(elem_type width = 0, elem_type hight = 0,string name = "para"):quad(name),width(width),hight(hight){} 
    
    ~para() {}
    double area() const {return width*hight ;}
    void showinfo()const {
        cout<<"this is a "<<name<<" the width is   "<<width<<"   the hight is   "<<hight<<endl;
    }
    void review()const {
        cout<<name<<":  "<<"width="<<width<<", hight="<<hight<<", anser="<<anser<<"  "<<result<<endl;
    }
};

class rect : virtual public para{
public:
    rect(elem_type hight = 0,elem_type width = 0 , string name = "rect") : para(width,hight,name) {}
    double area() const { return width*hight ; }
    void showinfo()const {
        cout<<"this is a "<<name<<" the width is   "<<width<<"   the hight is   "<<hight<<endl;
    }
    void review()const {
        cout<<name<<":  "<<"width="<<width<<", hight="<<hight<<", anser="<<anser<<"  "<<result<<endl;
    }
};

class diam : virtual public para{
public:
    diam(elem_type hight = 0,elem_type width = 0,string name = "diam") : para(width,hight,name) {}
    double area() const { return para::area() / 2.0; }
    void showinfo()const {
        cout<<"this is a "<<name<<" the width is   "<<width<<"   the hight is   "<<hight<<endl;
    }
    void review()const {
        cout<<name<<":  "<<"width="<<width<<", hight="<<hight<<", anser="<<anser<<"  "<<result<<endl;
    }
};

class square : public rect, public diam{
public:
    square(elem_type size = 0) : para(size,size,"square") {}
    double area() const {return rect::area() ; }
    void showinfo()const {
        cout<<"this is a "<<name<<" the side length is  "<<width<<endl;
    }
    void review()const {
        cout<<name<<":  "<<"width="<<width<<", anser="<<anser<<"  "<<result<<endl;
    }
};
